package com.loong.coupon.business;

import com.loong.common.mybatis.business.AbstractBusiness;
import com.loong.coupon.model.CouponApplyRule;
import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.entity.Condition;
import tk.mybatis.mapper.entity.Example;

/**
 * @Description:
 * @Author: LiuQun
 * @Date: 2021/1/11 22:18
 */
@Repository
public class CouponApplyRuleBusiness extends AbstractBusiness<CouponApplyRule> {

    /**
     * 根据优惠券id删除优惠券规则
     * @param couponId 优惠券id
     */
    public void deleteCouponApplyRuleByCouponId(Long couponId){
        Condition condition = new Condition(CouponApplyRule.class);
        Example.Criteria criteria = condition.createCriteria();
        criteria.andEqualTo("couponId",couponId);
        deleteByCondition(condition);
    }
}
